package itheima.common;

import com.baomidou.mybatisplus.annotation.TableLogic;

/**
 * 基于ThreadLocal封装工具类，用户保存和获取当前登录用户id
 * @author shkstart
 * @create 2022-09-16-15:59
 */
public class BaseContext {
    private static ThreadLocal<Long> threadLocal = new ThreadLocal<>();

    //设置用户id
    public static void setCurrentId(Long id){
        threadLocal.set(id);
    }
    //获取用户id
    public static Long getCurrentId(){
        return threadLocal.get();
    }
}
